#include<iostream>
#include<cmath>

class Point
{
public:
    Point():x(0),y(0){}
    Point(int x,int y):x(x),y(y){}

    void show()
    {
        std::cout<<"("<<x<<","<<y<<")"<<std::endl;
    }
    //友元关系
    //友元声明:允许该函数访问我的私有成员
    // friend double length(const Point &p);

    //友元类
    //友元关系时单向的
    //友元关系不可继承
    friend class Tool;

private:
    int x;
    int y;
};

class Tool
{
public:
static double length(const Point& p)
{
    return sqrt(p.x*p.x+p.y*p.y);
}

static double distance(const Point& p1, const Point& p2)
{
    int dx= p1.x-p2.x;
    int dy= p1.y-p2.y;
    return sqrt(dx*dx+dy*dy);
}
};

int main()
{
    Point p1(9,12);
    Point p2(7,4);
    p1.show();
    p2.show();
    std::cout<<Tool::distance(p1,p2)<<std::endl;
    return 0;
}